Salt data

NaCl

## tibble [17 x 4] (S3: tbl_df/tbl/data.frame)
##  $ navn      : num [1:17] 0 1 1 1 2 2 2 3 3 3 ...
##  $ Na  [mg/l]: num [1:17] 82 77 77 61 80 80 63 85 85 66 ...
##  $ Cl  [mg/l]: num [1:17] 131 117 118 97 120 120 100 127 125 105 ...
##  $ ...4      : chr [1:17] "Feed" "Feed" "Retentate" "Permeate" ...

CaCl2

## tibble [17 x 4] (S3: tbl_df/tbl/data.frame)
##  $ navn      : num [1:17] 0 1 1 1 2 2 2 3 3 3 ...
##  $ Ca  [mg/l]: num [1:17] 119 118 115 45 132 133 49 150 150 54 ...
##  $ Cl  [mg/l]: num [1:17] 216 223 220 106 246 248 109 277 265 121 ...
##  $ ...4      : chr [1:17] "Feed" "Feed" "Retentate" "Permeate" ...

SiO2

## tibble [17 x 4] (S3: tbl_df/tbl/data.frame)
##  $ navn        : num [1:17] 0 1 1 1 2 2 2 3 3 3 ...
##  $ SiO2  [mg/l]: num [1:17] 64.1 60.7 62 52.8 60.3 62.7 55.5 63.6 63.9 54.7 ...
##  $ Na  [mg/l]  : num [1:17] 47.6 48.5 48.3 21.1 53 52.7 24.4 59.5 58.9 27 ...
##  $ ...4        : chr [1:17] "Feed" "Feed" "Retentate" "Permeate" ...

MgSO4

Samlet Rejection

Osmotic Pressure

## [1] 23.19
## [1] 23.77
## [1] 24.13
## [1] 24.29
## [1] 24.42

We back in single salt databehandling

SS=rbind(Data,tst,tst2)
SS$recovery=SS$time/6
Mw_Cl=35.45
Mw_Na=22.99
Mw_Ca=40.078
Mw_SO4=96.06
Mw_SiO2=60.08
SS = SS%>%mutate("f_Na_mmol"=f_Na/Mw_Na)
SS = SS%>%mutate("f_Ca_mmol"=f_Ca/Mw_Ca)
SS = SS%>%mutate("f_Cl_mmol"=f_Cl/Mw_Cl)
SS = SS%>%mutate("f_SiO2_mmol"=f_SiO2/Mw_SiO2)

SS = SS%>%mutate("p_Na_mmol"=p_Na/Mw_Na)
SS = SS%>%mutate("p_Ca_mmol"=p_Ca/Mw_Ca)
SS = SS%>%mutate("p_Cl_mmol"=p_Cl/Mw_Cl)
SS = SS%>%mutate("p_SiO2_mmol"=p_SiO2/Mw_SiO2)

SS_plot=SS%>%gather(key="key",value="value",f_Na_mmol,f_Cl_mmol,f_SiO2_mmol,f_Ca_mmol)
SS_plot$ion=c(rep("Na",21),rep("Cl",21),rep("SiO2",21),rep("Ca",21))
SS_plot$var="Concentration"

ggplot(SS_plot,aes(x=recovery,y=value,color=ion))+geom_point()+geom_line()+facet_grid(cols=vars(exp))
## Warning: Removed 48 rows containing missing values (geom_point).
## Warning: Removed 46 row(s) containing missing values (geom_path).

SS_rej=SS%>%gather(key="key",value="value",Rej_Na,Rej_Cl,Rej_SiO2,Rej_Ca)
SS_rej$ion=c(rep("Na",21),rep("Cl",21),rep("SiO2",21),rep("Ca",21))
SS_rej$var="Rejection [%]"

ggplot(SS_rej,aes(x=recovery,y=value,color=ion))+geom_point()+geom_line()+facet_grid(cols=vars(exp))
## Warning: Removed 54 rows containing missing values (geom_point).
## Warning: Removed 50 row(s) containing missing values (geom_path).

SS_tot_plot=SS%>%gather(key="key",value="value",f_Na_mmol,f_Cl_mmol,f_SiO2_mmol,f_Ca_mmol,Rej_Na,Rej_Cl,Rej_SiO2,Rej_Ca)
SS_tot_plot$ion=rep(c(rep("Na",21),rep("Cl",21),rep("SiO2",21),rep("Ca",21)),2)
SS_tot_plot$var=c(rep("Feed Concentration [mM]",84),rep("Rejection [%]",84))


ggplotly(ggplot(SS_tot_plot,aes(x=recovery,y=value,color=ion))+geom_point()+geom_line()+ylim(0,NA)+
           facet_grid(cols=vars(exp),row =vars(var),scale="free",switch=NULL))
ioner=c(expression(Ca^{textstyle("2+")}),expression(Cl^{textstyle("-")}),expression(Na^{textstyle("+")}),expression(SiO[2]),expression(SO[4]^{textstyle("2-")}))
colors2=c( 
  '#d62728',  # brick red
  '#1f77b4',  # muted blue 
  '#2ca02c',  # cooked asparagus green
  '#9467bd',  # muted purple  
  '#ff7f0e',  # safety orange
  '#8c564b',  # chestnut brown
  '#e377c2',  # raspberry yogurt pink
  '#7f7f7f',  # middle gray
  '#bcbd22',  # curry yellow-green
  '#17becf'   # blue-teal
)

ggplot(SS_tot_plot,aes(x=recovery*100,y=value,color=ion))+geom_point()+geom_line()+ylim(0,NA)+
  xlab("Water Recovery [%]")+ylab(" ")+
           scale_color_manual(labels = ioner, values =colors2)+labs(colour = "Species")+
  theme(legend.text.align=0)+facet_grid(cols=vars(exp),row=vars(var),scale="free")
## Warning: Removed 102 rows containing missing values (geom_point).
## Warning: Removed 46 row(s) containing missing values (geom_path).

#bud på at lave den pæn, no worky
#ggplotly(ggplot(SS_tot_plot,aes(x=recovery,y=value,color=ion))+geom_point()+geom_line()+ylim(0,NA)+
#           facet_grid(cols=vars(exp),row =vars(var),scale="free"))+
#scale_color_brewer(palette= "Set1")

#ggplot()+geom_line(data=dat_M_9.2,aes(x=100*(1-(10-sek/60/60*1.02)/10),y=pH0201,color="ID:1 - pH 9.3"))+
#  geom_line(data=dat_M_10,aes(x=100*(1-(8.5-sek/60/60*1.02)/8.5),y=pH0201,color="ID:2 - pH 10.1"))+
#  geom_line(data=dat_M_10.5,aes(x=100*(1-(10-sek/60/60*1.02)/10),y=pH0201,color="ID:3 - pH 10.5"))+
#+
#  scale_x_continuous(limits=c(0, 90), breaks=c(0,20, 40,60,80 ))+
#  scale_y_continuous(limits=c(9, 10.75), breaks=c(9,9.5,10,10.5 ))+